<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>无标题文档</title>
	<link href="/static/css/default.css" rel="stylesheet" type="text/css">
	<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id='link'>
	<link href="/static/js/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">
</head>

<body style="padding:15px 8px 0px 8px;">



	<div class="classify">{$parenttitle}</div>
	<!--toolbar start-->
	<ul class="toolbar">
		<li>开始日期: <input type="text" style="width:120px;" class="forminput inputstyle" onfocus="WdatePicker()"
				id="stime" value=""></li>
		<li>结束日期: <input type="text" style="width:120px;" class="forminput inputstyle" onfocus="WdatePicker()"
				id="etime" value=""></li>


		<li><a href="#" class="selected" id="search">查询</a></li>
		<li><a href="#" class="selected" id="clear">重置</a></li>
		<li><a href="#" class="selected" id="del">清除时间段内日志</a></li>
	</ul>

	<!--toolbar end-->

	<!--tablebox start-->
	<div class="tablebox" id="main">

		<table>

			<thead>
				<th class="num"></th>
				<th>机构</th>
				<th>用户名</th>
				<th>IP</th>
				<th>时间</th>
				<th>位置</th>
				<th>终端类型</th>
				<th>操作</th>
			</thead>

			<tbody>


				<tr v-for="uitem in arrayData">
					<td><input type="checkbox"></td>

					<td>{{uitem.mechanismname}}</td>
					<td>{{uitem.username}}</td>
					<td>{{uitem.ip}}</td>
					<td>{{uitem.createtime}}</td>
					<td>{{uitem.address}}</td>
					<td>{{uitem.devicetype}}</td>
					<td>
						<a v-on:click="vdel(uitem)">删除</a>
					</td>
				</tr>
				</tr>



			</tbody>

		</table>

		<div class="pagination">



			<!-- <li><a href="#">尾页</a></li> -->
			<vue-nav :cur="cur" :all="all" :allcount="allcount" :callback="callback"></vue-nav>




		</div>
	</div>
	<!--tablebox end-->

	<!--pagination start-->


	<!--pagination end-->

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>

<script src="/static/js/layer/layer.js"></script>

<script type="text/javascript" src="/static/js/vue2.js"></script>
<script type="text/javascript" src="/static/js/vue-nav.js"></script>
<script src="/static/My97DatePicker/WdatePicker.js"></script>
<script>
	var vm = new Vue({
		el: "#main",
		data: {
			cur: 1,
			all: 0,
			size: 20,
			allcount: 0,
			arrayData: [],

		},
		components: {
			'vue-nav': Vnav
		},
		methods: {
			getdata: function (_keycontent) {  //查询数据

				var self = this;
				var stime = $("#stime").val();
				var etime = $("#etime").val();
				$.post("/super/system/getloginloglist", { page: self.cur, size: self.size, stime: stime, etime: etime }, function (_result) {
					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});

			},
			callback: function (data) {

				var self = this;
				this.cur = data;
				var stime = $("#stime").val();
				var etime = $("#etime").val();
				$.post("/super/system/getloginloglist", { page: self.cur, size: self.size, stime: stime, etime: etime }, function (_result) {

					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});
			},

			vdel: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要删除吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					$.post("/super/System/loginlogdel", { "id": uitem.id }, function (data) {
						if (data.status == 200) {
							parent.layer.msg(data.message);
							self.getdata("");
						} else {
							parent.layer.msg(data.message);
						}
					});
				}, function () {

				});

			}
		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata("");
		}
	});

	var search = false;
	$("#search").click(function () {

		vm.getdata("");
		search= true;
	});
	$("#clear").click(function () {

		$("#stime").val("");
		$("#etime").val("");


	});
	$("#del").click(function () {
		var stime = $("#stime").val();
		var etime = $("#etime").val();

			if(!search){
				layer.msg("请点击查询")
			}else if(stime==""||etime==""){
				layer.msg("时间段不能为空")
			}else{
				parent.layer.confirm('确定要删除吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					$.post("/super/System/loginloglistdel", { "stime": stime,"etime":etime }, function (data) {
						if (data.status == 200) {
							parent.layer.msg(data.message);
							vm.getdata("");
						} else {
							parent.layer.msg(data.message);
						}
					});
				}, function () {

				});

			}
		
	});


</script>

</html>